import axios from "axios";

export const key = "bba432a3386e82c1aaf0814eb0184742";
export const instance = axios.create({
  baseURL: "https://restapi.amap.com/v3",
  method: "get"
});

export const cityApi = {
  getCurrent: () => {
    return instance.get(`/ip?key=${key}`);
  },
  getGeo: (word) => {
    return instance.get(`/geocode/geo?address=${word}&key=${key}`);
  }
};

export const weatherApi = {
  getWeather: (city) => {
    return instance.get(`/weather/weatherInfo?city=${city}&key=${key}&extensions=all`);
  },
  getCurWeather: (city) => {
    return instance.get(`/weather/weatherInfo?city=${city}&key=${key}`);
  }
};